CC=mpicc
CFLAGS=-c -I/home/juanjo/mvapich2/src/include/ -fopenmp -O3
LFLAGS=-L/home/juanjo/mvapich2/lib/ -L/home/juanjo/mvapich2/src/openpa/src/ -fopenmp
SRC=utils/utils.c bcast/broadcast.c p2p/p2p.c main.c
HEAD=$(SRC:.c=.h)
OBJ=$(SRC:.c=.o)
EXE=mat_prod

all: $(OBJ) $(EXE)

$(EXE): $(OBJ)
	$(CC) $(LFLAGS) $(OBJ) -o $(EXE)

%.o: %.c
	$(CC) $(CFLAGS) $< -o $@

clean:
	rm $(OBJ) $(EXE)

erun: $(EXE)
	mpirun_rsh -np $(NP) -hostfile ./hosts $(EXE) $(ALG)

orun: $(EXE)
	mpirun_rsh -np $(NP) -hostfile ./hostso $(EXE) $(ALG)

irun: $(EXE)
	mpirun_rsh -np $(NP) -hostfile ./hostsib $(EXE) $(ALG)

collect: $(EXE)
	collect -m on -M CT8.2 -p 1000 -L 10000 mpirun -np $(NP) -hostfile ./hosts -- $(EXE) $(ALG)
